package com.jiazixuan.stock.mapper;

import com.jiazixuan.stock.pojo.entity.SysPermission;
import com.jiazixuan.stock.pojo.entity.SysRolePermission;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;
import java.util.List;

/**
* @author 17127
* @description 针对表【sys_role_permission(角色权限表)】的数据库操作Mapper
* @createDate 2025-08-14 11:17:58
* @Entity com.jiazixuan.stock.pojo.entity.SysRolePermission
*/
public interface SysRolePermissionMapper {

    int deleteByPrimaryKey(Long id);

    int insert(SysRolePermission record);

    int insertSelective(SysRolePermission record);

    SysRolePermission selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(SysRolePermission record);

    int updateByPrimaryKey(SysRolePermission record);

    /**
     * 添加角色权限关联
     * @param list
     * @return
     */
    int addRolePermission(@Param("list") List<SysRolePermission> list);


    List<Long> selectPermissionByRoleId(@Param("roleId") String roleId);

    /**
     * 删除角色权限
     * @param id
     * @param permissionsToDelete
     * @return
     */
    int deletePerByRoleIdAndPerId(@Param("id") Long id, @Param("perIds") List<Long> permissionsToDelete);

    void deleteByPermissionId(@Param("permissionId") String permissionId);
}
